package com.gcsoftware.web.beans.elasticsearchData;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.io.Serializable;
import java.util.List;

/**
 *  ES 返回实体类
 *  @author czp
 *  date : 2018-03-31
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Hit<T> implements Serializable {
    @JsonProperty("_index")
    private String index;

    @JsonProperty("_type")
    private String type;

    @JsonProperty("_id")
    private String id;

    @JsonProperty("_score")
    private double score;

    @JsonProperty("_source")
    private T source;

    @JsonProperty("sort")
    private List<Long> sort;

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("_index", index)
                .append("_type", type)
                .append("_id", id)
                .append("_score", score)
                .append("_source", source)
                .append("sort", sort)
                .toString();
    }

    public String getIndex() {
        return index;
    }

    public void setIndex(String index) {
        this.index = index;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }

    public T getSource() {
        return source;
    }

    public void setSource(T source) {
        this.source = source;
    }

    public List<Long> getSort() {
        return sort;
    }

    public void setSort(List<Long> sort) {
        this.sort = sort;
    }
}
